$OpenBSD: patch-fig2dev_Imakefile,v 1.9 2017/05/03 09:15:38 espie Exp $
* unhardcode directories
* use system's getopt

Index: fig2dev/Imakefile
--- fig2dev/Imakefile.orig
+++ fig2dev/Imakefile
@@ -34,7 +34,7 @@ XCOMM ******
 XCOMM You should point XFIGLIBDIR to the same directory you did when you compiled
 XCOMM and installed xfig.
 
-XFIGLIBDIR =	/usr/local/lib/X11/xfig
+XFIGLIBDIR =	$(LIBDIR)/xfig
 
 XCOMM ******
 XCOMM If your system doesn't have the strerror() function (has sys_errlist) then
@@ -53,7 +53,7 @@ XCOMM Uncomment the following line if your compiler su
 XCOMM inline functions. With the "INLINE" keyword, you should notice that
 XCOMM the display will be a bit faster in complex figures
 
-XCOMM USEINLINE = -DUSE_INLINE
+USEINLINE = -DUSE_INLINE
 
 XCOMM ****************
 XCOMM Change RGB if necessary, to point to your rgb.txt color database
@@ -74,9 +74,9 @@ XCOMM Redefine the following if your PNG library, zlib
 XCOMM file are in different places
 
 #ifdef USEPNG
-PNGLIBDIR = $(USRLIBDIR)
+PNGLIBDIR = ${LOCALBASE}/lib
 ZLIBDIR = $(USRLIBDIR)
-PNGINC = -I/usr/include/X11
+PNGINC = -I${LOCALBASE}/include
 #endif
 
 XCOMM ****************
@@ -91,8 +91,8 @@ XCOMM
 #define USEXPM
 
 #ifdef USEXPM
-XPMLIBDIR = $(USRLIBDIR)
-XPMINC = -I/usr/include/X11
+XPMLIBDIR = ${X11BASE}/lib
+XPMINC = -I${X11BASE}/include/X11
 #endif
 
 XCOMM ****************
@@ -141,7 +141,7 @@ XCOMM Comment out the next line if you have any proble
 
 #ifdef I18N
 I18N_DEFS = -DI18N 
-FIG2DEV_LIBDIR = /usr/local/lib/fig2dev
+FIG2DEV_LIBDIR = $(LIBDIR)/fig2dev
 I18N_DEV_DEFS = $(I18N_DEFS) -DFIG2DEV_LIBDIR=$(FIG2DEV_LIBDIR) -DFIG2DEV_LIBDIR_STR=\\\"$(FIG2DEV_LIBDIR)\\\"
 
 #endif /* I18N */
@@ -150,7 +150,7 @@ XCOMM ************************************************
 XCOMM *** You shouldn't have to change anything below this point ***
 XCOMM **************************************************************
 
-DIR_DEFS=	-DBITMAPDIR=\\\"$(DESTDIR)$(XFIGLIBDIR)/bitmaps\\\"
+DIR_DEFS=	-DBITMAPDIR=\\\"$(XFIGLIBDIR)/bitmaps\\\"
 
 #ifdef USEPNG
 DUSEPNG = -DUSE_PNG
@@ -168,7 +168,8 @@ STRSTRO=	strstr.o
 #endif /* defined(NOSTRSTR) */
 
 DEFINES = $(NEED_STRERROR) $(HAVE_NO_STRCASECMP) $(HAVE_NO_STRNCASECMP) $(DDNFSS) $(USEINLINE) \
-	$(I18N_DEFS) $(HAVE_SETMODE) $(DUSEPNG) $(DUSEXPM) $(PNGINC) $(XPMINC)
+	$(I18N_DEFS) $(HAVE_SETMODE) $(DUSEPNG) $(DUSEXPM) $(PNGINC) $(XPMINC) \
+	-Dfig_getopt=getopt
 
 
 IMAKE_DEFINES = $(DUSEPNG) $(DUSEXPM) $(I18N_DEV_DEFS) 
@@ -194,11 +195,6 @@ SYS_LIBRARIES = $(PNGLIBS) $(XPMLIBS) -lm -lcompat
 SYS_LIBRARIES = $(PNGLIBS) $(XPMLIBS) -lm
 #endif
 DEPLIBS = $(LIBTRANSFIG)
-
-#if !(defined(SunOSPlatform) && (OSMajorVersion>=5))
-GETOPTC=   getopt.c
-GETOPTO=   getopt.o
-#endif
 
 SRCS = fig2dev.c psfonts.c iso2tex.c arrow.c bound.c colors.c trans_spline.c \
 	free.c read.c read1_3.c latex_line.c localmath.c $(STRSTRC) $(GETOPTC)
